/**
 * ----------------------------------------------------------------------------
 * Copyright Jens Konopka
 * 
 * Alle Rechte vorbehalten.
 * Licence: Apache 2.0
 * ----------------------------------------------------------------------------
 *
 * created on 05.03.2012 by jkonopka
 */
package de.sql.toolkit.generator;

import java.util.HashSet;
import java.util.Set;


/**
 * @author jkonopka
 * 
 */
public class InsertScriptColumnGenerator implements IGenerator {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4286450408460324207L;
	private Set<String> columns = new HashSet<String>();

	/**
	 * @param columns
	 */
	public InsertScriptColumnGenerator(Set<String> columns) {
		this.columns = columns;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see de.sql.toolkit.generator.IGenerator#generate()
	 */
	@Override
	public String generate() throws Exception {
		final StringBuilder sb = new StringBuilder();
		for (final String column : columns) {
			sb.append(column);
			sb.append(" , ");
		}
		sb.delete(sb.lastIndexOf(" , "), sb.length());
		return sb.toString();
	}

}
